#!/usr/bin/bash

path=`cd "$( dirname ${BASH_SOURCE[0]} )" && pwd`
cd $path
source config.sh
#检测系统类型
source $bin/get_platform.sh
echo ==================================
#echo 警告！该功能目前处于六亲不认状态！
#echo 会清理当前用户全局缓存!
#echo 可能会影响您的其他项目正常运行！
echo 请选择需要清理的开发工具
echo 1.Python
echo 2.Nodejs
echo ==================================
read -p "请选择：" tool
if [[ $tool = 1 ]];then
	tool="python"
elif [[ $tool = 2 ]];then
	tool="node"
fi

echo ==================================
echo 请选择$tool的版本
echo ==================================

toolList=`ls $system_cache | grep $tool`

if [[ $toolList == '' ]];then
	exit
fi

for i in $toolList
do
	echo ${i#*"$tool"}
done

read -p "请选择上方版本：" version

echo "是否确定删除$tool$version?"
read -p "请选择y or n：" op
if [ $op = "y" ] || [ $op = "Y" ];then
  	echo "开始清理$tool$version"
 	rm -rf $system_cache/$tool$version
fi

